<?php
include_once('./base/xcx_sqlclass.php');
include_once('./base/xcx_commonclass.php');
$fun=new commonfun();
$mysql=new MMsql();

$userid=$_POST['userid'];
$wkid=$_POST['wkid'];
$stu_name=$_POST['stu_name'];
$casetype=$_POST['casetype'];
$stu_id=$userid.$fun->msecTime();
$sql="select isable from wk_students where user_id='".$userid."' and wk_id='".$wkid."'";
$result=$mysql->doSql($sql);
if(count($result)>0){///如果存在是禁用状态，更新
	$sql="update wk_students set isable='1',stu_name='".$stu_name."',casetype='".$casetype."' where user_id='".$userid."' and wk_id='".$wkid."'";
	$result=$mysql->doSql($sql);
	echo $result;
}else{//如果没有就插入
	$sql="insert into wk_students (stu_id,stu_name,user_id,wk_id,casetype)
	values('".$stu_id."','".$stu_name."','".$userid."','".$wkid."','".$casetype."')";
	$result=$mysql->doSql($sql);
	echo $result;
	
}

